# from datetime import datetime
#
# # 字段与数据类型的映射
# field_types = {
#     "dict_sort": "int",
#     "dict_label": "str",
#     "dict_value": "str",
#     "dict_type": "str",
#     "css_class": "str",
#     "list_class": "str",
#     "status": "str",
#     "create_by": "str",
#     "create_time": "datetime",
#     "remark": "str"
# }
#
#
# # 转换字段值为指定的类型
# def convert_value(value, field_type):
#     """根据字段类型转换值"""
#     if field_type == "int":
#         try:
#             return int(value)
#         except ValueError:
#             raise ValueError(f"Invalid value for int: {value}")
#     elif field_type == "float":
#         try:
#             return float(value)
#         except ValueError:
#             raise ValueError(f"Invalid value for float: {value}")
#     elif field_type == "str":
#         return str(value)
#     elif field_type == "datetime":
#         try:
#             # 假设日期格式为 'YYYY-MM-DD'，根据实际情况修改
#             return datetime.strptime(value, "%Y-%m-%d")
#         except ValueError:
#             raise ValueError(f"Invalid date format for datetime: {value}")
#     else:
#         raise ValueError(f"Unsupported field type: {field_type}")
#
#
# # 过滤并转换数据
# def filter_and_convert_data(json_data, required_fields, field_types):
#     converted_data = {}
#
#     for field in required_fields:
#         if field in json_data:
#             field_type = field_types.get(field)
#             value = json_data[field]
#
#             # 转换字段值为对应的类型
#             try:
#                 converted_data[field] = convert_value(value, field_type)
#             except ValueError as e:
#                 print(f"Error converting field '{field}': {e}")
#
#     return converted_data
#
#
# # 生成插入 SQL 语句
# def generate_insert_sql_with_converted_data(converted_data, table_name, field_types):
#     columns = ", ".join([f"`{key}`" for key in converted_data.keys()])  # 列名加反引号
#     values = ", ".join([f"'{v}'" if isinstance(v, str) else f"{v}" for v in converted_data.values()])
#     sql = f"INSERT INTO `{table_name}` ({columns}) VALUES ({values})"
#     return sql
#
#
# # 生成更新 SQL 语句
# def generate_update_sql_with_converted_data(converted_data, table_name, record_id, field_types):
#     set_clause = ", ".join([f"{key} = '{value}'" if isinstance(value, str) else f"`{key}` = {value}"
#                             for key, value in converted_data.items()])
#     sql = f"UPDATE `{table_name}` SET {set_clause} WHERE id = {record_id}"
#     return sql
#
#
# # 示例数据
# json_data = {
#     "dict_sort": "1",  # 字符串类型的数字
#     "dict_label": "example",
#     "dict_value": "value",
#     "dict_type": "type",
#     "css_class": "class",
#     "list_class": "list",
#     "status": "active",
#     "create_by": "admin",
#     "create_time": "2025-01-17",  # 日期字符串
#     "aaa": '111111'
# }
#
# # 必填字段列表
# required_fields = list(field_types.keys())
# print('required_fields', required_fields)
# # 调用数据过滤和转换
# converted_data = filter_and_convert_data(json_data, required_fields, field_types)
# print("Converted Data:")
# print(converted_data)
#
# # 使用转换后的数据生成插入 SQL
# insert_sql = generate_insert_sql_with_converted_data(converted_data, "your_table", field_types)
# print("\nGenerated Insert SQL:")
# print(insert_sql)
#
# # 假设要更新的记录 ID 为 1
# update_sql = generate_update_sql_with_converted_data(converted_data, "your_table", 1, field_types)
# print("\nGenerated Update SQL:")
# print(update_sql)


# from other.sql_montage import sqlMontage
#
# ss = sqlMontage()
#
# json_data = {'dictCode': 3, 'dictSort': 0, 'dictLabel': '高清相机', 'dictValue': '2', 'dictType': 'equip_type',
#              'cssClass': 'None', 'listClass': 'default', 'isDefault': 'N', 'status': '1', 'createBy': 'admin',
#              'createTime': '2025-01-17 10:49:48', 'updateBy': 'admin', 'updateTime': '2025-01-17 10:49:48',
#              'remark': 'None'}
# add_sql = ss.add_sql_data(json_data, 'sys_dict_data')
# print('add_sql', add_sql)
#
# edit_sql = ss.edit_sql_data(json_data, 'sys_dict_data', 'dict_code', '1')
# print('edit_sql', edit_sql)


import json

# 示例JSON数据
data = {
    "name": "John",
    "age": 30,
    "city": "New York"
}

# 删除指定键
key_to_delete = "age"
if key_to_delete in data:
    del data[key_to_delete]
print(data)

a = '测试'
b = ','.join([a])
print(b)
print(type(b))